package com.tmt.im.manager.mapstruct;

import com.tmt.im.common.pojo.IMFriendApplyPoJo;
import com.tmt.im.common.pojo.IMFriendPoJo;
import com.tmt.im.jpa.entity.IMFriend;
import com.tmt.im.manager.controller.vo.FriendInfoVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/8/25 15:04
 * @Version 1.0
 **/
@Component
@Mapper(componentModel = "spring")
public interface IMFriendMapStruct {

    @Mappings({
            @Mapping(target = "id", source = "friend.id"),
            @Mapping(target = "nickname", source = "friend.nickname"),
            @Mapping(target = "avatar", source = "friend.avatar"),
            @Mapping(target = "alias", expression = "java(com.tmt.im.manager.helper.IMFriendHelper.getAlias(friend))")
    })
    FriendInfoVo toFriendInfoVo(IMFriend friend);

    List<FriendInfoVo> toFriendInfoVos(List<IMFriend> friends);

}
